package com.ruoyi.gateway.config;
 
import java.util.Scanner;
 
public class Tax {
    public static void main(String[] args) {
        System.out.println("请输入您的税前收入");
        Scanner sc = new Scanner(System.in);
        double beforeTax = sc.nextDouble();                             //录入税前收入
       // double afterSocialSecurity = beforeTax - beforeTax * 0.1;       //缴纳社保后的收入
        double afterTax = beforeTax - 5000;                   //减去征税起步的金额
 
        double tax55000_80000 = (80000 - 55000) * 0.35;
        double tax35000_55000 = (55000 - 35000) * 0.3;
        double tax25000_35000 = (35000 - 25000) * 0.25;
        double tax12000_25000 = (25000 - 12000) * 0.2;
        double tax3000_12000 = (12000 - 3000) * 0.1;
        double tax0_3000 = 3000 * 0.03;
 
        if (afterTax >= 80000) {                                 //收入在80000以上的交0.45
            afterTax = afterTax - (afterTax - 80000) * 0.45 - tax55000_80000 - tax35000_55000 - tax25000_35000 - tax12000_25000 - tax3000_12000 - tax0_3000;
        }
 
        if (afterTax >= 55000 && afterTax < 80000) {             //收入在55000-80000的部分交0.35
            afterTax = afterTax - (afterTax - 55000) * 0.35 - tax35000_55000 - tax25000_35000 - tax12000_25000 - tax3000_12000 - tax0_3000;
        }
 
        if (afterTax >= 35000 && afterTax < 55000) {             //收入35000-55000的部分交0.3
            afterTax = afterTax - (afterTax - 35000) * 0.3 - tax25000_35000 - tax12000_25000 - tax3000_12000 - tax0_3000;
        }
 
        if (afterTax >= 25000 && afterTax <35000) {              //收入25000-35000的部分交0.25
            afterTax = afterTax - (afterTax - 25000) * 0.25 - tax12000_25000 - tax3000_12000 - tax0_3000;
        }
 
        if (afterTax >=12000 && afterTax < 25000) {              //收入12000-25000的部分交0.2
            afterTax = afterTax - (afterTax - 12000) * 0.2 - tax3000_12000 - tax0_3000;
        }
 
        if (afterTax >= 3000 && afterTax < 12000) {              //收入3000-12000的部分交0.1
            afterTax = afterTax - (afterTax - 3000) * 0.1 - tax0_3000;
        }
 
        if (afterTax < 3000 ) {                                  //3000的部分交0.03
            afterTax = afterTax - afterTax * 0.03;
        }
 
        afterTax = afterTax + 5000;
        System.out.println("您的税后收入为： " + afterTax);
    }
}